function deepClone(obj) {
  if (obj === null || typeof obj !== "object") {
    return obj;
  }
  if (Array.isArray(obj)) {
    const temple = [];
    obj.forEach((item, index) => {
      temple.push(deepClone(item));
    });
    return temple;
  } else {
    let temple = {};
    for (const key in obj) {
      temple[key] = deepClone(obj[key]);
    }
    return temple;
  }
}
const obj = {
    a: 1,
    b: {
        c: 2,
        d: [3, 4]
    }
};

const copy = deepClone(obj);
copy.b.c = 10;

console.log(obj.b.c);  // 2
console.log(copy.b.c); // 10
